package com.pheruagor.handmanager.controller {
    import com.pheruagor.handmanager.model.MemberEditionPopUpProxy;
    import com.pheruagor.handmanager.model.business.Member;
    import com.pheruagor.handmanager.view.MemberEditionPopUpMediator;
    import com.pheruagor.handmanager.view.component.MemberEditionPopUp;

    import mx.managers.PopUpManager;

    import org.puremvc.as3.interfaces.INotification;
    import org.puremvc.as3.patterns.command.SimpleCommand;

    public class CloseMemberEditionPopUpCommand extends SimpleCommand {
        public static const NAME:String = "closeMemberEditionPopUpCommand";
        public static const EXECUTED:String = NAME + "Executed";

        override public function execute(notification:INotification):void {
            var popup:MemberEditionPopUp = MemberEditionPopUp(notification.getBody().popup);
            facade.removeMediator(MemberEditionPopUpMediator.NAME);
            PopUpManager.removePopUp(popup);
            var member:Member = Member(notification.getBody().member);
            facade.removeProxy(MemberEditionPopUpProxy.NAME);
            sendNotification(EXECUTED, member);
        }
    }
}